<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

namespace App\Controller;

use App\Library\Traits\BaseControllerTrait;
use Hyperf\Logger\LoggerFactory;

class IndexController extends AbstractController
{
    use BaseControllerTrait;

    public function __construct(LoggerFactory $loggerFactory)
    {
        parent::__construct();
        $this->logger = $loggerFactory->get();
    }

    public function index(): array
    {
        $this->logger->info(random());
        return success([
            'method' => $this->request->getMethod(),
            'query' => $this->request->query(),
            'random' => random(),
        ]);
    }
}
